<template>
    <div id="clubJoin">
        <div class="title">加入的社团</div>
        <div class="choice">
            <div class="type">类型：
                <el-select v-model="typeValue" placeholder="请选择">
                    <el-option size="20px" value="全部">全部</el-option>
                    <el-option v-for="item in typeOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
                </el-select>
            </div>
            <div class="date">加入时间：
                <el-date-picker v-model="dateValue" format="yyyy-MM-dd" type="datetimerange" start-placeholder="开始日期" range-separator="至" end-placeholder="结束日期"
                value-format="yyyy-MM-dd HH:mm:ss" :clearable="false" :picker-options="pickerOption"  @change="changeDate" ></el-date-picker>
            </div>
            <div class="search">
                <el-input size="mini" placeholder="名称" v-model="searchInput"></el-input>
                <div><i class="el-icon-search"></i></div>
            </div>
        </div>
        <!-- 列表 -->
        <div class="content">
            <div class="list">
                <img src="../../image/beijingtu.png" alt="" class="left">
                <div class="right">
                    <div class="headline">音乐的基本知识和技巧</div>
                    <div class="joinSite">活动地点：顺义文化馆舞蹈教室</div>
                    <div class="joinTime">加入时间：2021-03-05</div>
                    <div class="joinType">社团类型：舞蹈</div>
                    <div class="button">
                        <div class="viewDetails">查看详情</div>
                        <div class="quitJoin" @click="quitJoin">退出社团</div>
                    </div>
                </div>
            </div>
        </div>
        <!-- 分页 -->
        <div class="paging">
            <div class="page" @click="homePage">首页</div>
            <!-- v-show="pageSize > 0"
            :total="listData.length"
            @pagination="getListData" -->
            <el-pagination background
                :total="45"
                layout="prev, pager, next"
                prev-text="上一页"
                next-text="下一页"
                :page-size="pageSize"
                @current-change="clickChange">
            </el-pagination>
            <div class="page" @click="trailingPage">尾页</div>
        </div>
        <!-- 退出社团 -->
        <div id="quitJoin" v-show="cancelShow">
            <div class="prompt">
                <div class="top">退出社团<i class="el-icon-circle-close" style="color: #F19417;" @click="hideJoin"></i></div>
                <div class="center">您确定要退出社团吗？</div>
                <div class="bottom">
                    <div class="confirm" @click="confirm">确定</div>
                    <div class="cancel" @click="cancel">取消</div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
export default {
	data() {
		return {
            // 类型
            typeOptions: [{
                value: '选项1',
                label: '黄金糕'
                }, {
                value: '选项2',
                label: '双皮奶'
                }, {
                value: '选项3',
                label: '蚵仔煎'
                }, {
                value: '选项4',
                label: '龙须面'
                }, {
                value: '选项5',
                label: '北京烤鸭'
            }],
            typeValue: "全部",// 类型的选择
            dateValue: new Date(),// 日期的选择
            // start: new Date(),
            // over: new Date(),
            pickerOption: {//今天之后的日期禁用
                disabledDate(time) {
                    //如果没有后面的-8.64e6就是不可以选择今天的
                    return time.getTime() > Date.now() - 8.64e6;
                },
            },
            searchInput: "",// 搜索框输入的内容
            pageNum: 1, //显示第几页
            pageSize: 6, //一页的数据数量
            cancelShow: false, // 取消收藏默认隐藏
        };
	},
    mounted(){
        this.dateFormat() // 转换时间格式
    },
	methods: {
        // 默认转换时间格式
        dateFormat() {
            var date = new Date()
            // console.log(date)
            var year = date.getFullYear()  //年
            var month = date.getMonth() + 1
            month = month < 10 ? ('0' + month) : month  //月
            var days = date.getDate()
            days = days < 10 ? ('0' + days) : days  //日
            // this.start = year + '年' + month + '月' + days + '日' + ' ' + '00时00分00秒'
            // console.log(this.start)
            var hours = date.getHours()
            hours = hours < 10 ? ('0' + hours) : hours  //时
            var minutes = date.getMinutes()
            minutes = minutes < 10 ? ('0' + minutes) : minutes  //分
            var seconds = date.getSeconds()
            seconds = seconds < 10 ? ('0' + seconds) : seconds  //秒
            // this.over = year + '-' + month + '-' + days + ' ' + hours + ':' + minutes + ':' + seconds
            // console.log(this.over)
        },
        // 点击选择开始与结束时间
        changeDate(data) {
            console.log(data)
            // this.start = data[0]
            // // this.over = data[1]
            // // console.log(this.start,this.over)
            // let overTime = data[1];
            // overTime = overTime.replace(/-/g, '/')
            // let overDataTime  = new Date(overTime)
            // let year = overDataTime.getFullYear() + '-'
            // let month = (overDataTime.getMonth() + 1 < 10 ? '0' + (overDataTime.getMonth()+1) : overDataTime.getMonth() + 1) + '-'
            // let days = (overDataTime.getDate() < 10 ? '0' + overDataTime.getDate() : overDataTime.getDate())
            // let overAfter = year + month + days + ' ' + '23:59:59'
            // this.over = overAfter// new Date(overAfter)
            // // console.log(this.dateValue,this.start,this.over)
        },
        // 显示退出社团弹框
        quitJoin(){
            this.cancelShow = true
        },
        // 关闭退出社团弹框
        hideJoin(){
            this.cancelShow = false
        },
        // 确定退出社团
        confirm(){
            this.cancelShow = false
            this.$message({
                message: "退出社团成功",
                type: 'success'
            });
        },
        // 取消退出社团
        cancel(){
            this.cancelShow = false
        },
        // 首页
        homePage() {
            this.clickChange(1)
        },
        // 当前页
        clickChange(val) {
            this.pageNum = val;
            console.log(this.pageNum)
            // this.getListData();
        },
        // 尾页
        trailingPage(val) {
            this.pageNum = val;
            // console.log(this.pageNum)
            // this.getListData();
        },
    },
    watch: {},
}
</script>

<style scoped lang="less">
@media screen and (min-width: 1400px){
    #clubJoin{
        padding: 3% 5%;
        .title{
            width: 100%;
            font-size: 24px;
            padding-bottom: 2%;
            border-bottom: 1px solid #ddd;
        }
        .choice{
            width: 96%;
            font-size: 16px;
            padding: 2% 2% 1% 2%;
            border-bottom: 1px solid #ddd;
            display: flex;
            // 类型
            .type{
                // width: 40%;
                margin-right: -5%;
                /deep/.el-select{
                    width: 60%;
                }
                /* selecte 框的高度设置，默认是 4px*/
                /deep/.el-input__inner{
                    height: 30px;
                }
                /* 下面设置右侧按钮居中 */
                /deep/.el-input__suffix {
                    top: 5px;
                }
                /deep/.el-input__icon {
                    line-height: inherit;
                }
                /deep/.el-input__suffix-inner {
                    display: inline-block;
                }
            }
            // 收藏时间
            .date{
                margin-right: -16%;
                /deep/.el-input__inner{
                    width: 50%;
                    height: 30px;
                }
                /deep/.el-range__icon{
                    height: 30px;
                    // color: white;
                }
                /deep/.el-range-separator{
                    height: 30px;
                }
            }
            // 搜索框
            .search{
                display: flex;
                .el-input{
                    flex: 4;
                }
                div{
                    height: 95%;
                    flex: 1;
                    background: #DDDDDD;
                    display: flex;
                    justify-content: center;
                    align-items: center;
                }
            }
        }
        // 列表
        .content{
            width: 100%;
            // height: 530px;
            height: 400px;
            overflow: auto;
            margin-top: 2%;
            display: flex;
            flex-wrap: wrap; // 自动换行
            .list:hover{
                box-shadow: 0px 5px 10px 0px rgba(64, 45, 20, 0.15);
            }
            .list{
                width: 46%;
                height: 160px;
                margin: 1% 2%;
                border-radius: 10px;
                display: flex;
                .left{
                    flex: 1;
                    width: 50%;
                    border-radius: 10px;
                }
                .right{
                    flex: 1;
                    width: 46%;
                    margin: 0% 2%;
                    .headline{
                        font-size: 18px;
                        font-family: PingFang SC;
                        font-weight: 400;
                        color: #333333;
                        margin: 5% 0% 5% 0%;
                        // 单行溢出隐藏
                        overflow:hidden;
                        text-overflow:ellipsis;
                        white-space:nowrap;
                    }
                    .joinSite,.joinTime,.joinType{
                        font-family: PingFang SC;
                        font-weight: 400;
                        color: #888888;
                        margin-top: 2%;
                        // 单行溢出隐藏
                        overflow:hidden;
                        text-overflow:ellipsis;
                        white-space:nowrap;
                    }
                    .button{
                        display: flex;
                        margin-top: 10%;
                        div{
                            flex: 1;
                            margin: 0% 3%;
                            height: 30px;
                            font-size: 12px;
                            // 水平垂直居中
                            display: flex;
                            justify-content: center;
                            align-items: center;
                            color: white;
                        }
                        .viewDetails{
                            background: #F19417;
                        }
                        .quitJoin{
                            background: #888;
                        }
                    }
                }
            }
        }
        // 分页
        .paging{
            width: 100%;
            margin-top: 5%;
            // 水平垂直居中
            display: flex;
            justify-content: center;
            align-items: center;
            /deep/.el-pagination.is-background .el-pager li:not(.disabled).active {
                background-color: #F19417;
            }
            .page{
                width: 7%;
                text-align: center;
                line-height: 30px;
                background: #F0F0F0;
                border-radius: 2px;
                margin: 0% 0.5%;
            }
        }
        // 取消收藏
        #quitJoin{
            width: 100%;
            height: 916px;
            background: rgba(56, 46, 46, 0.2);
            position: absolute;
            top: 0%;
            left: 0%;
            .prompt{
                width: 22%;
                background: #FFFFFF;
                border-radius: 5px;
                margin: 15% 0% 0% 35%;
                text-align: center;
                .top{
                    font-size: 18px;
                    font-weight: 500;
                    line-height: 40px;
                    padding-top: 3%;
                    i{
                        float: right;
                        margin: 0% 3% 0% 0%;
                    }
                }
                .center{
                    font-size: 14px;
                    margin: 10% 0%;
                }
                .bottom{
                    width: 100%;
                    display: flex;
                    padding-bottom: 10%;
                    div{
                        width: 20%;
                        line-height: 30px;
                        border-radius: 5px;
                    }
                    .confirm{
                        margin: 0% 5% 0% 25%;
                        background: #F19417;
                        color: white;
                    }
                    .cancel{
                        background: #ddd;
                    }
                }
            }
        }
    }
}



@media screen and (max-width: 1400px){
    #clubJoin{
        padding: 2% 4%;
        .title{
            width: 100%;
            font-size: 22px;
            padding-bottom: 1.5%;
            border-bottom: 1px solid #ddd;
        }
        .choice{
            width: 96%;
            font-size: 14px;
            padding: 2% 2% 1% 2%;
            border-bottom: 1px solid #ddd;
            display: flex;
            // 类型
            .type{
                // width: 40%;
                margin-right: -5%;
                /deep/.el-select{
                    width: 60%;
                }
                /* selecte 框的高度设置，默认是 4px*/
                /deep/.el-input__inner{
                    height: 30px;
                }
                /* 下面设置右侧按钮居中 */
                /deep/.el-input__suffix {
                    top: 5px;
                }
                /deep/.el-input__icon {
                    line-height: inherit;
                }
                /deep/.el-input__suffix-inner {
                    display: inline-block;
                }
            }
            // 收藏时间
            .date{
                margin-right: -16%;
                /deep/.el-input__inner{
                    width: 50%;
                    height: 30px;
                }
                /deep/.el-range__icon{
                    height: 30px;
                    // color: white;
                }
                /deep/.el-range-separator{
                    height: 30px;
                }
            }
            // 搜索框
            .search{
                display: flex;
                .el-input{
                    flex: 4;
                }
                div{
                    height: 95%;
                    flex: 1;
                    background: #DDDDDD;
                    display: flex;
                    justify-content: center;
                    align-items: center;
                }
            }
        }
        // 列表
        .content{
            width: 100%;
            // height: 530px;
            height: 400px;
            overflow: auto;
            margin-top: 2%;
            display: flex;
            flex-wrap: wrap; // 自动换行
            .list:hover{
                box-shadow: 0px 5px 10px 0px rgba(64, 45, 20, 0.15);
            }
            .list{
                width: 46%;
                height: 140px;
                margin: 1% 2%;
                border-radius: 10px;
                display: flex;
                .left{
                    flex: 1;
                    width: 50%;
                    border-radius: 10px;
                }
                .right{
                    flex: 1;
                    width: 46%;
                    margin: 0% 2%;
                    .headline{
                        font-size: 18px;
                        font-family: PingFang SC;
                        font-weight: 400;
                        color: #333333;
                        margin: 4% 0%;
                        // 单行溢出隐藏
                        overflow:hidden;
                        text-overflow:ellipsis;
                        white-space:nowrap;
                    }
                    .joinSite,.joinTime,.joinType{
                        font-family: PingFang SC;
                        font-weight: 400;
                        color: #888888;
                        margin-top: 2%;
                        // 单行溢出隐藏
                        overflow:hidden;
                        text-overflow:ellipsis;
                        white-space:nowrap;
                    }
                    .button{
                        display: flex;
                        margin-top: 8%;
                        div{
                            flex: 1;
                            margin: 0% 3%;
                            height: 26px;
                            font-size: 10px;
                            // 水平垂直居中
                            display: flex;
                            justify-content: center;
                            align-items: center;
                            color: white;
                        }
                        .viewDetails{
                            background: #F19417;
                        }
                        .quitJoin{
                            background: #888;
                        }
                    }
                }
            }
        }
        // 分页
        .paging{
            width: 100%;
            margin-top: 5%;
            // 水平垂直居中
            display: flex;
            justify-content: center;
            align-items: center;
            /deep/.el-pagination.is-background .el-pager li:not(.disabled).active {
                background-color: #F19417;
            }
            .page{
                width: 7%;
                text-align: center;
                line-height: 30px;
                background: #F0F0F0;
                border-radius: 2px;
                margin: 0% 0.5%;
            }
        }
        // 取消收藏
        #quitJoin{
            width: 100%;
            height: 916px;
            background: rgba(56, 46, 46, 0.2);
            position: absolute;
            top: 0%;
            left: 0%;
            .prompt{
                width: 22%;
                background: #FFFFFF;
                border-radius: 5px;
                margin: 15% 0% 0% 35%;
                text-align: center;
                .top{
                    font-size: 18px;
                    font-weight: 500;
                    line-height: 40px;
                    padding-top: 3%;
                    i{
                        float: right;
                        margin: 0% 3% 0% 0%;
                    }
                }
                .center{
                    font-size: 14px;
                    margin: 10% 0%;
                }
                .bottom{
                    width: 100%;
                    display: flex;
                    padding-bottom: 10%;
                    div{
                        width: 20%;
                        line-height: 30px;
                        border-radius: 5px;
                    }
                    .confirm{
                        margin: 0% 5% 0% 25%;
                        background: #F19417;
                        color: white;
                    }
                    .cancel{
                        background: #ddd;
                    }
                }
            }
        }
    }
}
</style>